package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.HighLeverFaultCheckService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by xu_jiaHui on 2018/3/24.
 */
@Controller
@RequestMapping("/rds_highLeverFaultCheck")
public class HighLeverFaultCheckController {
    @Resource
    private HighLeverFaultCheckService highLeverFaultCheckService;

    @RequestMapping(value = "/getHighLeverFault4DT")
    @ResponseBody
    public DTResponseDto getHighLeverFault4DT(DTRequestDto dtRequestDto, Integer actorId, Integer orgId) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = highLeverFaultCheckService.getHighLeverFault4DT(dtRequestDto, actorId, orgId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/highLeverFaultAudit")
    @ResponseBody
    public JsonMsgDto highLeverFaultAudit(Integer isPass, String feedback, Integer highLeverFaultId, Integer userId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(highLeverFaultCheckService.highLeverFaultAudit(isPass, feedback, highLeverFaultId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getHighLeverFaultCheckList4App")
    @ResponseBody
    public JsonMsgDto getHighLeverFaultCheckList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size)
            throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(highLeverFaultCheckService.getHighLeverFaultCheckList4App(orgId, actorIds, faultStatus, count, size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }
}

